<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>订单主表--${site.name}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="description" content="${site.description}"/>
    <meta name="keywords" content="${site.keywords}"/>
    <meta name="author" content="${site.author}"/>
    <link rel="icon" href="${site.logo}">
    <link rel="stylesheet" href="${base}/static/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="${base}/static/css/user.css" media="all" />
</head>
<body class="childrenBody">
    <form class="layui-form" id="searchForm">
   		<div class="layui-inline" style="margin-left: 15px">
            <label>订单状态:</label>
            <div class="layui-input-inline">
            <select name="s_status">
                <option value="" selected="">请选择</option>
                <#list statusMap?keys as key>
			        <option value="${key}">${statusMap["${key}"]}</option>
			    </#list>
            </select>
            </div>
   		</div>
   		<div class="layui-inline" style="margin-left: 15px">
            <label>订单号:</label>
            <div class="layui-input-inline">
	            <input name="s_orderno" class="layui-input" placeholder="订单号查询">
            </div>
   		</div>
        <div class="layui-inline">
            <a class="layui-btn" lay-submit="" lay-filter="searchForm">查询</a>
        </div>
    </form>
<div class="layui-form users_list">
    <table class="layui-table" id="test" lay-filter="demo"></table>

    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="detail"><i class="layui-icon">&#xe702;</i>详情</a>
    </script>
</div>
<div id="page"></div>
<script type="text/javascript" src="${base}/static/layui/layui.js"></script>
<script type="text/javascript" src="${base}/static/js/tools.js"></script>
<script>
    layui.use(['layer','form','table','laydate'], function() {
        var layer = layui.layer,
        $ = layui.jquery,
        form = layui.form,
        laydate = layui.laydate,
        table = layui.table;


        //监听工具条
        table.on('tool(demo)', function(obj){
            var data = obj.data;
            if(obj.event === 'detail'){
                var editIndex = layer.open({
                    title : '查看',
                    type : 2,
                    shade: 0.3,
                    shadeClose: true,
					closeBtn: 0,
					anim: 3,
					resize:false,
					isOutAnim: false,
					offset: 'r',
                    area:['80%','100%'],
                    content : "${base}${adminPrefix}/mall-order/detail?id="+data.id
                });
            } 
        });

        var t = {
            elem: '#test',
            url:'${base}${adminPrefix}/mall-order/list',
            method:'post',
            toolbar: '#toolbarDemo', //开启头部工具栏，并为其绑定左侧模板
            defaultToolbar: ['filter', 'exports', 'print'], //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
            page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'], //自定义分页布局
                //,curr: 5 //设定初始在第 5 页
                groups: 2, //只显示 1 个连续页码
                first: "首页", //显示首页
                last: "尾页", //显示尾页
                limits:[3,10, 20, 30]
            },
            cellMinWidth: 80, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            cols: [[
                {field:'orderno',    title: '订单号'},
                {field:'createTime',    title: '下单时间'},
                {field:'pcount',    title: '商品总数',width:'10%'},
                {field:'',    title: '订单金额',templet:function(d){
                	return '总金额：￥'+d.priceTotal+', 运费：￥'+(d.priceFee?d.priceFee:'0')+', 实付：￥'+d.priceReal
                }},
                {field:'status',    title: '订单状态',width:'10%',templet:function(d){
                	return d.exts.orderStatusStr;
                }},
                {fixed: 'right', title:'操作',   align: 'center',toolbar: '#barDemo',width:'10%'}
            ]]
        };
        table.render(t);
        
        form.on("submit(searchForm)",function(data){
            t.where = data.field;
            table.reload('test', t);
            return false;
        });

    });
</script>
</body>
</html>